- /* sdfacosh.cpp by K.Tsuru */
- // function ID 3309 DRADIX
- /********************************************
- inverse hyperbolic (area cosh)
- arcosh(x) for x >= 1.0 ... not arccosh
- Definition
- arcosh(x) = [+|-]log(x + sqrt(x*x - 1) )
- For 0 < x - 1.0 << 1.0 a formura
- arcosh x = 2*artanh(sqrt( (x-1)/(x+1) ))
- is used.
- Return a positive value.
- **********************************************/
- #ifndef SN_H
- #include "sn.h"
- #endif
- SDouble Acosh(const SDouble& x){
- SDouble r;
- SDouble dev1 = x - ONE;
-
- if(dev1.Sign(3309) < 0) x.SetError(x.DOMAIN_ERR, "Acosh",3309); //x < 1
- // x >= 1
- if(dev1.Sign() == 0){ // x = 1
- r.SetZero(); return r;
- }
- // x > 1
- int dev1exp = dev1.NetRdxExp();
- if(dev1exp < -1){ // x - 1.0 < DRADIX^(-2)
- // arcosh x = 2*artanh(sqrt( (x-1)/(x+1) ))
- r = (x+ONE)/dev1; // (x+1)/(x-1)
- r = RecSqrt(r); // r < 1/DRADIX
- r = AtanhSeries(r);
- r = DsMult(r, 2);
- } else{
- r = x + Sqrt(dev1*(x + ONE)); // r = x+Sqrt(x*x -1)
- r = Log(r);
- }
- return r;
- }
sdfacosh.cpp : last modifiled at 2016/08/29 16:43:32(1,019 bytes)
created at 2017/10/07 10:22:50
The creation time of this html file is 2017/10/07 11:29:39 (Sat Oct 07 11:29:39 2017).